package com.luyuan.wxapp.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.luyuan.common.annotation.Anonymous;
import com.luyuan.common.core.domain.AjaxResult;
import com.luyuan.gallery.domain.ExhiGallery;
import com.luyuan.gallery.service.IExhiArtworkService;
import com.luyuan.gallery.service.IExhiGalleryService;
import com.luyuan.gallery.vo.ExhiArtworkVO;
import com.luyuan.gallery.vo.ExhiGalleryVO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.luyuan.common.core.page.TableDataInfo;

/**
 * 展厅Controller
 * 
 * @author luyuan
 * @date 2025-11-13
 */
@Api(value = "微信小程序展览接口", tags = "wx_gallery")
@RestController
@RequestMapping("/wxapp/gallery")
public class WxappExhiGalleryController extends WxBaseController {

    @Autowired
    private IExhiGalleryService exhiGalleryService;

    @Autowired
    private IExhiArtworkService exhiArtworkService;

    /**
     * 查询展厅列表
     */
    @ApiOperation(value = "获取展厅列表", notes = "获取展厅列表", nickname = "getGalleryList")
    @Anonymous
    @GetMapping("/list")
    public TableDataInfo list(ExhiGallery exhiGallery) {
        startPage();
        List<ExhiGalleryVO> list = exhiGalleryService.selectExhiGalleryList(exhiGallery);
        return getDataTable(list);
    }

    /**
     * 获取展厅详细信息
     */
    @ApiOperation(value = "获取展厅详细信息", notes = "获取展厅详细信息", nickname = "getGalleryInfo")
    @Anonymous
    @GetMapping(value = "/{galleryId}")
    public AjaxResult getInfo(@PathVariable("galleryId") Long galleryId) {
        return AjaxResult.success(exhiGalleryService.selectExhiGalleryByGalleryId(galleryId));
    }

    /**
     * 获取展厅作品列表
     * 
     */
    @ApiOperation(value = "获取展厅作品列表", notes = "获取展厅作品列表", nickname = "getGalleryArtworkList")
    @GetMapping("/artworklist")
    public AjaxResult getGalleryArtworkList(Long galleryId) {
        List<ExhiArtworkVO> list = exhiArtworkService.selectExhiArtworkListByGalleryId(galleryId);
        return AjaxResult.success(list);
    }
}
